Add pathMappings option to debugger#2251
Merged
andyleejordan merged 3 commits intoPowerShell:mainfrom Sep 4, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a pathMappings option to the PowerShell debugger that enables mapping between local and remote file paths during debugging sessions. This is particularly useful when debugging remote PowerShell instances where the local development environment has the same files but at different paths.
Key changes:
- Adds
PathMappingrecord to define local-to-remote path mappings - Integrates path mapping logic into breakpoint setting, stack trace handling, and script launching
- Adds comprehensive end-to-end test for attach scenarios with path mappings
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| PathMapping.cs | New record defining the structure for local/remote path mappings |
| DebugService.cs | Core path mapping logic with methods to translate between local and remote paths |
| LaunchAndAttachHandler.cs | Integration of path mappings into launch and attach request handling |
| StackTraceHandler.cs | Updates stack trace paths using path mappings for remote debugging |
| BreakpointService.cs | Modified to use mapped paths when setting breakpoints |
| BreakpointApiUtils.cs | Added script path override parameter for breakpoint setting |
| DisconnectHandler.cs | Cleanup of path mappings on disconnect |
| DscBreakpointCapability.cs | Minor refactor to extract module name instead of full module info |
| DebugAdapterProtocolMessageTests.cs | Comprehensive E2E test for path mapping functionality |
Comments suppressed due to low confidence (1)
test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs:580
- Spelling error: 'cotinue' should be 'continue'.
// background and requesting the st is the only wait to ensure
src/PowerShellEditorServices/Services/DebugAdapter/PathMapping.cs
Outdated
Show resolved
Hide resolved
test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs
Outdated
Show resolved
Hide resolved
test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
Contributor
Author
3 tasks
a182fe6 to
23ef91b
Compare
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/StackTraceHandler.cs
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/PowerShell/Debugging/DscBreakpointCapability.cs
Show resolved
Hide resolved
test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs
Show resolved
Hide resolved
649a4c1 to
163cd74
Compare
Adds the `pathMappings` option to the debugger that can be used to map a local to remote path and vice versa. This is useful if the local environment has a checkout of the files being run on a remote target but at a different path. The mappings are used to translate the paths that will the breakpoint will be set to in the target PowerShell instance. It is also used to update the stack trace paths received from the remote. For a launch scenario, the path mappings are also used when launching a script if the integrated terminal has entered a remote runspace.
163cd74 to
6dda2c6
Compare
pathMappings option to debugger
andyleejordan
pushed a commit
to PowerShell/vscode-powershell
that referenced
this pull request
Sep 4, 2025
Contributor
Author
|
Thanks for the review and merge! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Summary
Adds the
pathMappingsoption to the debugger that can be used to map a local to remote path and vice versa. This is useful if the local environment has a checkout of the files being run on a remote target but at a different path. The mappings are used to translate the paths that will the breakpoint will be set to in the target PowerShell instance. It is also used to update the stack trace paths received from the remote.For a launch scenario, the path mappings are also used when launching a script if the integrated terminal has entered a remote runspace.
PR Context
Fixes: #2242